/*
 * @Author: Laputa
 * @Version: V0.0
 * @Date: 2024-01-16 16:20:32
 * @LastEditors: Laputa
 * @LastEditTime: 2024-01-22 14:50:53
 * @Description: 
 * 
 * Copyright (c) 2024 by Levetop, All Rights Reserved. 
 */
#ifndef _CSS_PSRAM_H
#define _CSS_PSRAM_H

#include "LT168_Config.h"
void MCU_CSS_RESET(qspi *target,uint8_t y);
//#define PSRAM_CS(x, y) (MCU_CSS_RESET(x, y))
#define PSRAM_CS(x, y) (QSPI_CS_GPIO_Write(x, y))
#define FLASH_CS(x, y) (QSPI_CS_GPIO_Write(x, y))

void CSS_PSRAM_Init(qspi *qspix, uint16_t sck_dv);
uint32_t CSS_PSRAM_Read_ID(qspi *qspix);
void CSS_PSRAM_Enter_QPI(qspi *qspix);
uint32_t CSS_PSRAM_Reset(qspi *qspix);
uint32_t CSS_PSRAM_Reset_QPI(qspi *qspix);
void CSS_PSRAM_Exit_QPI(qspi *qspix);

void CSS_PSRAM_Read_QPI_DMA(qspi *qspix, uint16_t sck_dv, uint32_t addr, uint8_t *p, uint32_t num);
void CSS_PSRAM_Write_QPI_DMA(qspi *qspix, uint16_t sck_dv, uint32_t addr, uint8_t *p, uint32_t num);
void CSS_PSRAM_Flash_To_Psram_DMA(qspi *psram_qspix, qspi *flash_qspix, uint16_t sck_dv, uint32_t psram_addr, uint32_t flash_addr, uint32_t num, uint8_t flash_addr_type);
void LT_CSS_PSRAM_Write_QPI_DMA_Color(uint32_t addr, uint16_t color, uint16_t num);

void LT_CSS_PSRAM_Write_QPI_DMA(uint32_t addr, uint8_t *p, uint32_t num);
void LT_CSS_PSRAM_Read_QPI_DMA(uint32_t addr, uint8_t *p, uint32_t num);

#endif
